package com.zy.algorithm.fragment;

import android.view.View;


import com.zy.algorithm.R;
import com.zy.algorithm.controller.screen.BaseColumnChartFirstScreenController;
import com.zy.algorithm.curtain.IScreenBean;
import com.zy.zlog.ZLog;


public abstract class BaseAlgorithmColumnChartFragment extends BaseAlgorithmFragment {

    private static final String TAG = "BaseAlgorithmColumnChart";

    BaseColumnChartFirstScreenController firstScreenController;

    @Override
    protected int getLayout() {
        return R.layout.fragment_algorithm_column_chart_base;
    }

    @Override
    protected void initView(View view) {
        super.initView(view);
        initEnteringContainer(view);
        firstScreenController = buildScreenController(view, getColorAni());
    }

    protected BaseColumnChartFirstScreenController buildScreenController(View view, boolean colorAni) {
        return new BaseColumnChartFirstScreenController(view, getColorAni());
    }

    private View entering_container;
    private View algorithm_context_container;

    private void initEnteringContainer(View view) {
        entering_container = view.findViewById(R.id.entering_container);
        algorithm_context_container = view.findViewById(R.id.algorithm_context_container);
    }

    @Override
    protected View getEnterContainer() {
        return entering_container;
    }

    @Override
    protected View getContextContainer() {
        return algorithm_context_container;
    }

    @Override
    protected void initScreenData() {
        super.initScreenData();
        firstScreenController.initScreenData();
    }

    @Override
    protected void resetAll() {
        firstScreenController.statuesResetAll();
    }

    @Override
    protected void setScreenData(IScreenBean iScreenBean, boolean start) {
        firstScreenController.setScreenData(iScreenBean, start);
    }

    @Override
    protected void sortAnimation(int index, IScreenBean screenBean, StepListener listener) {
        ZLog.d(TAG, "" + index + " " + screenBean);
        //执行幕动画
        //幕动画结束->把动画数据交给幕动画-控制器
        //子动画结束 -> 幕 退出动画
        //后执行下一个

        if (screenBean.isNeedScreenAnimation()) {

        } else {

        }
        firstScreenController.startSubCartoon(screenBean.getCartoonStepBeanList(), new StepListener() {

            @Override
            public void nextStep() {
                //子动画结束 -> 幕 退出动画
                listener.nextStep();
            }
        });
    }
}
